import { RouteRecordRaw } from "vue-router";
import noAuthView from "../views/NoAuthView.vue";
import ACCESS_EUNM from "@/access/ACCESS_EUNM";
import userLayout from "@/layouts/UserLayout.vue";
import userLogin from "@/views/user/UserLogin.vue";
import userRegist from "@/views/user/UserRegist.vue";
import questionAddView from "@/views/question/QuestionAddView.vue";
import questionManageView from "@/views/question/QuestionManageView.vue";
import questionListView from "@/views/question/QuestionListView.vue";
import questionPracticeView from "@/views/question/QuestionPracticeView.vue";
import questionSubmitView from "@/views/question/QuestionSubmitView.vue";

export const routes: RouteRecordRaw[] = [
  {
    path: "/user",
    name: "用户登录",
    component: userLayout,
    // meta: {
    //   needHide: true,
    // },
    children: [
      { path: "", name: "用户", component: userLogin },
      // {
      //   path: "/user/regist", // 子路由
      //   name: "用户注册",
      //   component: userRegist,
      // },
      {
        path: "/user/login",
        name: "用户登录",
        component: userLogin,
      },
    ],
  },
  {
    path: "/question_submit",
    name: "题目状态查看",
    component: questionSubmitView,
  },
  {
    path: "/question/lsit",
    name: "题目列表",
    component: questionListView,
    meta: {
      access: ACCESS_EUNM.LOGIN_SUCCESS,
    },
  },

  {
    path: "/question/edit",
    name: "题目编辑",
    component: questionAddView,
    meta: {
      needHide: true,
    },
  },
  {
    path: "/question/do/:id",
    name: "题目练习",
    component: questionPracticeView,
    props: true,
    meta: {
      access: ACCESS_EUNM.LOGIN_SUCCESS,
      needHide: true,
    },
  },
  {
    path: "/question/manage",
    name: "题目管理",
    component: questionManageView,
    meta: {
      access: ACCESS_EUNM.LOGIN_SUCCESS,
    },
  },

  {
    path: "/",
    name: "主页",
    component: questionListView,
    meta: {
      needHide: true,
    },
  },
  {
    path: "/noAuth",
    name: "无权限界面",
    component: noAuthView,
    meta: {
      needHide: true,
    },
  },
  {
    path: "/question/add",
    name: "题目创建",
    component: questionAddView,
    meta: {
      access: ACCESS_EUNM.ADMIN,
    },
  },
];
